import { request } from '@/utils/request'

//获取今日新闻
export const queryNewsLatest = () => request('/article/getNewsLatest', 'GET')

//获取往日新闻
export const queryNewsBefore = (time) => request('/article/getNewsBefore', 'GET', { time })

//获取新闻详情
export const queryNewsInfo = (id) => request('/article/getNewsInfo', 'GET', { id })

//获取评论数
export const queryNewsStory = (id) => request('/article/getNewsStory', 'GET', { id })

//获取所有文章接口
export const getAllArticle = () => request('/article/getAllArticle', 'GET')

//用户收藏文章接口
export const favorite = (article_id, user_id) =>
  request('/article/favorite', 'POST', { article_id, user_id })

//用户取消收藏文章接口
export const cancelFavorite = (article_id, user_id) =>
  request('/article/cancelFavorite', 'POST', { article_id, user_id })

//判断用户文章收藏状态接口
export const IsFavorite = (article_id, user_id) =>
  request('/article/isFavorite', 'POST', { article_id, user_id })

//判断用户对该文章的点赞状态
export const IsLike = (article_id, user_id) =>
  request('/article/isLike', 'POST', { article_id, user_id })

//用户收藏中心接口
export const articleStore = (user_id) => request('/article/articleStore', 'POST', { user_id })

//统计用户收藏的文章数量
export const getFavoriteStoreNum = (user_id) =>
  request('/article/getFavoriteStoreNum', 'GET', { user_id })

//记录用户阅读历史记录接口
export const readHistory = (formData) => request('/article/readHistory', 'POST', formData)

//查询用户阅读历史记录功能接口
export const queryReadHistory = (user_id) =>
  request('/article/queryReadHistory', 'GET', { user_id })

//清空历史记录接口
export const delAllReadHistory = (user_id) =>
  request('/article/delAllReadHistory', 'POST', { user_id })

//用户点赞文章接口
export const like = (article_id, user_id) =>
  request('/article/like', 'POST', { article_id, user_id })

//用户取消点赞文章接口
export const cancelLike = (article_id, user_id) =>
  request('/article/cancelLike', 'POST', { article_id, user_id })

//查询文章的所有点赞总数接口
export const getLikeNum = (article_id) => request('/article/getLikeNum', 'GET', { article_id })

//查询文章的所有评论总数接口
export const getcommentsNum = (article_id) =>
  request('/article/getcommentsNum', 'GET', { article_id })

//发送评论信息接口
export const sendcomment = (formData) => request('/article/sendComment', 'POST', formData)

//获取文章所有评论信息接口
export const getcomments = (article_id) => request('/article/getcomments', 'GET', { article_id })
